﻿using System;
using System.Collections.Generic;
using Ease.EaseNode.Runtime;
using Sirenix.OdinInspector;
using UnityEngine;

namespace Ease.EaseMission.Runtime
{
    [Serializable]
    public partial class MissionStep : BaseEaseNodeData, IMissionStep, INodeDataManagerHolder
    {
        [SerializeField] [OnValueChanged(nameof(OnAnyValueChange))]
        private int id;

        [SerializeField] [OnValueChanged(nameof(OnAnyValueChange))]
        private string name;

        [SerializeReference] [OnValueChanged(nameof(OnAnyValueChange))]
        private List<MissionData> datas = new List<MissionData>();

        public int Id
        {
            get => id;
            set => id = value;
        }

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        public List<MissionData> Datas => datas;

        public string Tip => $"[{id}][{name} {datas.Count}]";

        protected override IEaseNodeAgent OnCreateAgent()
        {
            return new MissionStepHandler(this);
        }
    }
}